package com.xcity.game.equip.suit4.impl;

import com.xcity.game.combat.ActionEffect;
import com.xcity.game.combat.ActionEffect.Value;
import com.xcity.game.combat.attr.CombatAttributeType;
import com.xcity.game.combat.unit.CombatUnit;
import com.xcity.game.common.GameStaticConfig;
import com.xcity.game.equip.suit4.BaseSuit4;
import com.xcity.game.equip.template.EquipSuitEffectTemplate;

/**
 * 杜嘉班纳4件套<br/>
 * 受到的伤害降低{15}%
 * @author yang.li
 *
 */
public class Suit4DolceGabbana extends BaseSuit4 {

	public Suit4DolceGabbana(CombatUnit unit, EquipSuitEffectTemplate template) {
		super(unit, template);
	}

	@Override
	public void preDamage(ActionEffect effect) {
		if (unit.getId() != effect.getUnitId()) {
			return;
		}
		int hpDelta = effect.getHpDelta();
		if (hpDelta < 0) {
			Value v = effect.getValue(CombatAttributeType.HP);
			hpDelta += -hpDelta/*>0*/ * template.getSuit4Param(0) / GameStaticConfig.percentBase;
			v.setDelta(hpDelta < 0 ? hpDelta : 0);
		}
	}

}
